home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / WINER.ZIP / CHAP12_1.ASM < prev    next >
Assembly Source File  |  1992-05-13  |  765b  |  33 lines

  1. ;CHAP12-1.ASM, returns "True" or "False" as a near string
  2.  
  3. ;Copyright (c) 1991 Ethan Winer
  4.  
  5. ;Syntax: Answer$ = TrueFalse$(Argument%)
  6.  
  7. .Model Medium, Basic
  8. .Data
  9.   DescLen DW 0
  10.   DescAdr DW 0
  11.   True    DB "True"
  12.   False   DB "False"
  13.  
  14. .Code
  15. TrueFalse Proc, Argument:Word
  16.  
  17.   Mov  DescLen,4            ;assume true
  18.   Mov  DescAdr,Offset True
  19.  
  20.   Mov  BX,Argument          ;get the address for Argument%
  21.   Cmp  Word Ptr [BX],0      ;is it zero?
  22.   Jne  Exit                 ;no, so we were right
  23.  
  24.   Inc  DescLen              ;yes, return five characters
  25.   Mov  DescAdr,Offset False ;and the address of "False"
  26.  
  27. Exit:
  28.   Mov  AX,Offset DescLen    ;show where the descriptor is
  29.   Ret                       ;return to BASIC
  30.  
  31. TrueFalse Endp
  32. End
  33.